<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<div class="t_bar">
    <span class="color_red">*</span>${param.title}
</div>
<table id="shareholder" cellpadding="0" class="table01 t_css" width="100%" border="0" cellpadding="0"
       style="*border-bottom: #a1c0dc 1px solid;">
    <thead>
    <tr>
        <th width="5%">选择</th>
        <th width="5%">序号</th>
        <th width="18%">股东名称</th>
        <th width="18%">认缴出资额（万元）</th>
        <th width="18%">实缴出资额（万元）</th>
        <th width="18%">出资形式</th>
        <th width="18%">股权比例（%）</th>
    </tr>
    </thead>
    <tbody id="tab">
    <tr style="display: none">
        <td align="center">
            <input type="radio" class="radiobutton" name="setshareholder">
        </td>
        <td align="center">
            <span name="shareholders|shareholder[0]@seq_no">[index]</span>
        </td>
        <td align="center">
            <input name="shareholders|shareholder[0]|shareholder_name"
                   value="" label="股东名称" class="required input_text" maxlength="100"
                   style="width: 80%"/>
        </td>
        <td align="center"><input
                name="shareholders|shareholder[0]|renjiaofunds" value="" label="认缴出资额"
                onfocus="InitInput.setNumber(this,9,2,2)"
                onchange="counttotal('shareholder','renjiaofunds_total',3);"
                class="required input_text" style="text-align: right;width: 80%"/></td>
        <td align="center"><input
                name="shareholders|shareholder[0]|shijiaofunds" value="" label="实缴出资额"
                onfocus="InitInput.setNumber(this,9,2,2)"
                onchange="counttotal('shareholder','shijiaofunds_total',4);"
                class="required input_text" style="text-align: right;width: 80%"/></td>
        <td align="center"><input name="shareholders|shareholder[0]|investment_way"
                                  value="" label="出资形式" class="required input_text" maxlength="100" style="width: 80%"/></td>
        <td align="center"><input name="shareholders|shareholder[0]|equity_ratio" value="" label="股权比例"
                                  onchange="counttotal('shareholder','equity_ratio_total',6);"
                                  id="equity_ratio[0]"
                                  class="required input_text valueLENum:equity_ratio[0]:100" onfocus="InitInput.setNumber(this,3,2,2)"
                                  style="text-align: right; width: 80%"/></td>
    </tr>
    <c:set value="0" var="index" scope="page"/>
    <x:forEach select="$xmlData/data/shareholders/shareholder" var="shareholder">
        <c:choose>
            <c:when test="${index<10}">
                <c:set value="0" var="flag" scope="page"/>
            </c:when>
            <c:otherwise>
                <c:set value="" var="flag" scope="page"/>
            </c:otherwise>
        </c:choose>
        <tr>
            <td align="center"><input type="radio" class="radiobutton"
                                      name="setshareholder"></td>
            <td align="center"><span
                    name="shareholders/shareholder[${flag}${index}]@seq_no"><x:out
                    select="$shareholder/@seq_no"/></span></td>
            <td align="center"><input
                    name="shareholders/shareholder[${flag}${index}]/shareholder_name"
                    value="<x:out select="$shareholder/shareholder_name"/>" label="股东名称"
                    class="required input_text" maxlength="100" style="width: 80%"/></td>
            <td align="center"><input
                    name="shareholders/shareholder[${flag}${index}]/renjiaofunds"
                    onchange="counttotal('shareholder','renjiaofunds_total',3);"
                    value="<x:out select="$shareholder/renjiaofunds"/>" label="认缴出资额"
                    onfocus="InitInput.setNumber(this,9,2,2)"
                    class="required input_text" style="text-align: right;width: 80%"/></td>
            <td align="center"><input
                    name="shareholders/shareholder[${flag}${index}]/shijiaofunds"
                    onchange="counttotal('shareholder','shijiaofunds_total',4);"
                    value="<x:out select="$shareholder/shijiaofunds"/>" label="实缴出资额"
                    onfocus="InitInput.setNumber(this,9,2,2)"
                    class="required input_text" style="text-align: right;width: 80%"/></td>
            <td align="center"><input
                    name="shareholders/shareholder[${flag}${index}]/investment_way" maxlength="100"
                    value="<x:out select="$shareholder/investment_way"/>" label="出资形式"
                    class="required input_text"
                    style="width: 80%"/></td>
            <td align="center"><input
                    name="shareholders/shareholder[${flag}${index}]/equity_ratio"
                    onchange="counttotal('shareholder','equity_ratio_total',6);"
                    id="equity_ratio[${flag}${index}]"
                    value="<x:out select="$shareholder/equity_ratio"/>" label="股权比例"
                    class="required input_text valueLENum:equity_ratio[${flag}${index}]:100"
                    onfocus="InitInput.setNumber(this,3,2,2)"
                    style="text-align: right; width: 80%"/></td>
        </tr>
        <c:set value="${index+1}" var="index" scope="page"/>
    </x:forEach>
    </tbody>

</table>
<table class="t_css" id="shareholdercount">
    <col width="28%">
    <col width="18%">
    <col width="18%">
    <col width="18%">
    <col width="18%">
    <tr>
        <td align="right">合计：</td>
        <td align="center"><input type="text" id="renjiaofunds_total"
                                  disabled name="shareholder/renjiaofunds_total" label="合计-->认缴出资额"
                                  onfocus="InitInput.setNumber(this,9,2,2)"
                                  style="text-align: right; width: 80%" class="gray" disabled
                                  value="<x:out select="$xmlData/data/shareholder/renjiaofunds_total" />"/>
        </td>
        <td align="center"><input type="text" id="shijiaofunds_total"
                                  disabled name="shareholder/shijiaofunds_total" label="合计-->实缴出资额"
                                  onfocus="InitInput.setNumber(this,9,2,2)"
                                  style="text-align: right; width: 80%" class="gray" disabled
                                  value="<x:out select="$xmlData/data/shareholder/shijiaofunds_total" />"/>
        </td>
        <td align="center" class="gray">/</td>
        <td align="center"><input type="text" id="equity_ratio_total"
                                  disabled name="shareholder/equity_ratio_total" label="合计-->股权比例"
                                  onfocus="InitInput.setNumber(this,3,2,2)" disabled
                                  style="text-align: right; width: 80%" class="gray valueLENum:equity_ratio_total:100"
                                  value="<x:out select="$xmlData/data/shareholder/equity_ratio_total" />"/>
        </td>
    </tr>
</table>
<br/>
<table width="98%" align="center" border="0" cellpadding="0"
       cellspacing="1">
    <tr>
        <td><input class="button_02" type="button" name="cmdAddbefore" value="添加"
                   onclick="if(checkTabLimit('shareholder',99,'科技团队最新股权结构及股东情况最多只能填写99条记录')){addNewRow('shareholder');showDateTag('shareholder');}try{top.resizeFrame();}catch(e){};counttotal('shareholder','renjiaofunds_total',3);counttotal('shareholder','shijiaofunds_total',4);counttotal('shareholder','equity_ratio_total',6);">&nbsp;
            <input class="button_02" name="cmdMovePrev" type="button" value="上移"
                   onclick="movePrev('shareholder','setshareholder');"> &nbsp;
            <input class="button_02" name="cmdMoveNext" type="button" value="下移"
                   onclick="moveNext('shareholder','setshareholder');"> &nbsp;
            <input class="button_02" name="cmddel" type="button" value="删除"
                   onclick="deleteSelectedRow('shareholder','科技团队最新股权结构及股东情况');counttotal('shareholder','renjiaofunds_total',3);counttotal('shareholder','shijiaofunds_total',4);counttotal('shareholder','equity_ratio_total',6);">
        </td>
    </tr>
</table>

<script type="text/javascript">
    function counttotal(tabId, objId, col1) {
        var count = 0;
        $("#" + tabId + " tr:gt(1)").each(function () {
            var fund1 = $(this).children().eq(col1).children().val();
            if (!$.isNumeric(fund1)) {
                fund1 = "0";
            }
            count = ((parseFloat(count) * 10000 + parseFloat(fund1) * 10000) / 10000);
        });
        count = formatNumberAuto(count.toString(), 9, 2, 2);

        $("#" + objId).val(count);
    }

    $(document).ready(function () {
        $("#shareholder").each(function () {
            $(this).find("tr:even").addClass("li_1");
            $(this).find("tr:odd").addClass("li_2");
        });
    });
</script>